package com.anda.model.web;

import com.anda.enums.StatusCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

/**
 * @author baisongyuan
 * @className CustomResponse
 * @description
 * @date 2022/10/7 17:45
 */
@Data
@AllArgsConstructor
@Builder
public class CustomResponse<T> {
    private String message;
    private Integer code;
    private T data;


    public static <T> CustomResponse<T> success(T data) {
        return CustomResponse.<T>builder()
                .code(StatusCodeEnum.SUCCESS.code())
                .message(StatusCodeEnum.SUCCESS.msg())
                .data(data)
                .build();
    }
}
